//camera.sqf
#include "ACV_Constantes.h"
#include "ACV_ID_main_dlg.h"

call ACV_FNCT_MakeUnit;

disableSerialization;
_display = findDisplay ACV_DLG_ID_Main_Dlg;
_txt_sys = _display displayCtrl ACV_DLG_ID_Main_TxtSystem;
[_txt_sys,localize "STR_MSG_PLACE_CAMERA"] spawn ACV_FNCT_FlashMessage;

ACV_Pos = false;
ACV_Void = false;
ACV_Go = false;
onMapSingleClick "ACV_Pos = _pos;ACV_Void = true;ACV_Go = true;true;";
waitUntil {ACV_Void};
onMapSingleClick "";
if (! ACV_Go) exitWith {};

closedialog 0;
[format [localize "STR_MSG_IN_CAMERA",(name player)]] call ACV_FNCT_BroadcastMessage;
_pos = ACV_Pos;
_cam = "Logic" createVehicleLocal _pos;
_cam setPos [(_pos select 0),(_pos select 1),(_pos select 2) + 30];
_cam exec "camera.sqs";
enableEnvironment true;
titleCut ["","BLACK OUT"];
titleFadeOut 9;
titleText [localize "STR_MSG_CAMERA_SPECTATOR","PLAIN DOWN"];
titleFadeOut 9;
cutText ["","BLACK IN"];
titleFadeOut 9;
ACV_NET_Camera = format ["*** ACV CAMERA *** %1 : %2",name player,ACV_Pos];
publicVariable "ACV_NET_Camera";

sleep 0.05;
private "_code";
_code = compile "diag_log ACV_NET_Camera;";
[ACV_BROADCAST_TO_SERVER,_code,_code] call ACV_FNCT_BroadcastCode;
waitUntil {isNull BIS_DEBUG_CAM};
deleteVehicle _cam;

ACV_PosMapACV = _pos;
